/**
   {
   "death": { // 身份证正面
   "proportions": 0, //状态 0未完成 1已完成
   "circumstances": "UMID", // 证件类型
   "belated": "" // 【重要】图片url
   },
   "clergyman": { //活体照片
   "proportions": 0, //状态 0未完成 1已完成
   "belated": "" //【重要】 图片url
   },
   "daughter": 0, //照片上传类型: 0.拍照+相册; 1.拍照
   "attend": [ //【重要】首选证件类型
   'UMID',
   'DRIVINGLICENSE',
   'NATIONALID',
   'PASSPORT',
   'TIN',
   ],
   "begun": [ //【重要】备选证件类型
   'PRC',
   'SSS',
   'POSTALID',
   'VOTERID',
   'PAGIBIG',
   'HEALTHCARD',
   ]
   }
*/

/// 身份证正面/证件照片模型
class DnpIdentityFrontModel {
  int? proportions; // 状态 0未完成 1已完成
  String? circumstances; // 证件类型
  String? belated; // 图片url

  DnpIdentityFrontModel({
    this.proportions,
    this.circumstances,
    this.belated,
  });

  factory DnpIdentityFrontModel.fromJson(Map<String, dynamic>? json) {
    if (json == null) return DnpIdentityFrontModel();
    return DnpIdentityFrontModel(
      proportions: json['proportions'] as int?,
      circumstances: json['circumstances'] as String?,
      belated: json['belated'] as String?,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'proportions': proportions,
      'circumstances': circumstances,
      'belated': belated,
    };
  }
}

/// 活体照片模型
class DnpLivePhotoModel {
  int? proportions; // 状态 0未完成 1已完成
  String? belated; // 图片url

  DnpLivePhotoModel({
    this.proportions,
    this.belated,
  });

  factory DnpLivePhotoModel.fromJson(Map<String, dynamic>? json) {
    if (json == null) return DnpLivePhotoModel();
    return DnpLivePhotoModel(
      proportions: json['proportions'] as int?,
      belated: json['belated'] as String?,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'proportions': proportions,
      'belated': belated,
    };
  }
}

/// 身份照片主模型
class DnpIdentityModel {
  DnpIdentityFrontModel? death; // 身份证正面
  DnpLivePhotoModel? clergyman; // 活体照片
  int? daughter; // 照片上传类型: 0.拍照+相册; 1.拍照
  List<String>? attend; // 首选证件类型
  List<String>? begun; // 备选证件类型
  String? id_front_msg;
  String? face_msg;

  DnpIdentityModel({
    this.death,
    this.clergyman,
    this.daughter,
    this.attend,
    this.begun,
    this.id_front_msg,
    this.face_msg,
  });

  factory DnpIdentityModel.fromJson(Map<String, dynamic>? json) {
    if (json == null) return DnpIdentityModel();
    return DnpIdentityModel(
      death: DnpIdentityFrontModel.fromJson(json['death'] as Map<String, dynamic>?),
      clergyman: DnpLivePhotoModel.fromJson(json['clergyman'] as Map<String, dynamic>?),
      daughter: json['daughter'] as int?,
      attend: (json['attend'] as List<dynamic>?)?.map((e) => e as String).toList(),
      begun: (json['begun'] as List<dynamic>?)?.map((e) => e as String).toList(),
      id_front_msg: json['id_front_msg'] as String?,
      face_msg: json['face_msg'] as String?,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'death': death?.toJson(),
      'clergyman': clergyman?.toJson(),
      'daughter': daughter,
      'attend': attend,
      'begun': begun,
      'id_front_msg': id_front_msg,
      'face_msg': face_msg,
    };
  }
}